package com.xzm.test;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import com.xzm.factory.InstanceFactory;
import com.xzm.service.IUserService;
import com.xzm.service.impl.UserServiceImpl;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * @author 3052
 * @create 2020-07-26 21:12
 */
public class main {

    public static void main(String[] args) {
/*        ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
        IUserService userService = ac.getBean("userService",IUserService.class);
        System.out.println(userService);*/

        ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
/*        IUserService userService_temp = ac.getBean("UserService",UserServiceImpl.class);
        System.out.println(userService_temp);*/
        //InstanceFactory instanceFactory = (InstanceFactory)ac.getBean("instanceFactory");
        //IUserService userService = instanceFactory.getUserService();
        IUserService userService = (UserServiceImpl)ac.getBean("userService");
        userService.saveUser();
        System.out.println(userService);
        ac.close();

    }
}
